#include <Ethernet.h>
#include <SPI.h>
byte mac[] = { 0xDE, 0xAD, 0xEF, 0xFE, 0xED };
char temp[4];

// Sleep de 5 minutos
int sleep = 300000;
IPAddress ip(10,0,0,110);

IPAddress server(10,0,0,102);

EthernetClient client;

void setup() {
   Ethernet.begin(mac, ip);
   delay(1000);  
   Serial.begin(9600);
}

void loop() {
  int reading = analogRead(2);
  float temp_f = (100 * reading * 5.0)/1024;
  
  // converte a temp em string antes de enviar o pacote
  dtostrf(temp_f, 4, 2, temp);
  
  if (client.connect(server, 666)) {
     client.println(temp);
     client.stop();
  } 
  delay(sleep);              
}
